﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Crosland.Automotriz.Logic;
using System.Configuration;

namespace Crosland.Automotriz.Web.SSIS
{
    public partial class wFrmCargaEstadosFinancieros : System.Web.UI.Page
    {
        string idNegocio = ConfigurationManager.AppSettings["Negocio"];

        EjecutarJobsLogic jobExec = new EjecutarJobsLogic();

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            int id;
            string msg = string.Empty;

            id = jobExec.StatusJob("EstadosFinancieros");
            msg = jobExec.MsgStatusJobGeneral(id);

            lblMensajeGeneral.Text = msg;

            if (id != 1)
            {
                btnEjecutarPaquete.Enabled = false;
                lblMensajeGeneral.Text = msg;
                Timer1.Enabled = false;
                Image1.Visible = false;
            }
        }

        protected void btnEjecutarPaquete_Click(object sender, EventArgs e)
        {
            string job = "EstadosFinancieros";
            string status = jobExec.StartSqlJob(job);
            lblMensajeGeneral.Text = status;
            btnEjecutarPaquete.Enabled = false;
            Timer1.Enabled = true;
            Image1.Visible = true;
        }

        protected void btnSalir_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Repuestos/wFrmDefault.aspx?id=" + idNegocio);
        }
    }
}